import React from "react";
import { CoverImage, CoverView } from "@tarojs/components";
import Taro from "@tarojs/taro";

import "./index.less";
import centermodalPng from "../../assets/footer/center.png";

export default (props) => {
  const goPlan = () => {
    Taro.navigateTo({ url: "/pages/add/index" });
    props.setCMStatus(false);
  };

  const goAddEvent = () =>{
    Taro.switchTab({
      url: "/pages/schedule/index" 
    })
    // Taro.navigateTo({ url: "/pages/addEvent/index" });
    props.setCMStatus(false);
  }
  
  return (
    <CoverView className="center-modal">
      <CoverView className="center-actions">
        <CoverView className="center-action">
          <CoverView onClick={goPlan} className="center-item">
            新建方案
          </CoverView>
          <CoverView onClick={goAddEvent} className="center-item">新建日程</CoverView>
        </CoverView>
        <CoverView className="center-icons">
          <CoverView
            className="center-icon"
            onClick={() => {
              props.setCMStatus(false);
            }}
          >
            <CoverImage src={centermodalPng} className="center-img" />
          </CoverView>
        </CoverView>
      </CoverView>
    </CoverView>
  );
};
